var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, r) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var r in e)
              Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
          })(e, r);
      };
      return function (e, r) {
        function o() {
          this.constructor = e;
        }
        if ("function" != typeof r && null !== r)
          throw new TypeError(
            "Class extends value " + String(r) + " is not a constructor or null"
          );
        t(e, r),
          (e.prototype =
            null === r
              ? Object.create(r)
              : ((o.prototype = r.prototype), new o()));
      };
    })(),
  DropMoneyHistoryView = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        e.btn_dropMoney_back.on(Laya.Event.CLICK, e, e.onDropMoneyBackAction),
        WebSocketService.addListener({
          caller: e,
          code: 1562,
          method: e.onLoadCurPaiMingData,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 1563,
          method: e.onLoadCurYingJiaData,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 1564,
          method: e.onLoadCurTouZhuData,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 1565,
          method: e.onLoadCurKaiJiangData,
        }),
        (e.list_drop_history.vScrollBarSkin = ""),
        e
      );
    }
    return (
      __extends(e, t),
      (e.showDropHistoryView = function (t) {
        return (
          null == this.dropHis && (this.dropHis = new e()),
          (this.dropHis.type = t),
          "11" == t
            ? ((this.dropHis.label_dropMoney_title.text = "当前排行"),
              WebSocketService.send({ c: 1562, d: { pageNum: 0 } }))
            : "12" == t
            ? ((this.dropHis.label_dropMoney_title.text = "投注记录"),
              WebSocketService.send({ c: 1564, d: { pageNum: 0 } }),
              (this.dropHis.label_dropMoney_mingzi.text = "开奖"),
              (this.dropHis.label_dropMoney_chouma.text = "结果"))
            : "13" == t &&
              ((this.dropHis.label_dropMoney_title.text = "开奖记录"),
              (this.dropHis.label_dropMoney_paiming.text = "轮数"),
              (this.dropHis.label_dropMoney_mingzi.text = "开奖"),
              (this.dropHis.label_dropMoney_chouma.text = "结果"),
              WebSocketService.send({ c: 1565, d: { pageNum: 0 } })),
          (this.dropHis.dataSource = []),
          (this.dropHis.enjoyDataArr = []),
          this.dropHis
        );
      }),
      (e.prototype.onLoadCurPaiMingData = function (t) {
        if (0 == t.code) {
          if (this.currentPage >= 1) {
            if (0 == t.list.length) return void this.currentPage--;
            for (o = 0; o < t.list.length; o++) {
              var e = t.list[o];
              this.enjoyDataArr.push(e), (this.dataSource = []);
            }
          } else (this.enjoyDataArr = t.list), (this.dataSource = []);
          this.isloading = !1;
          for (var r = void 0, o = 0; o < this.enjoyDataArr.length; o++)
            (r = {
              label_drop_index: { text: this.enjoyDataArr[o].r },
              label_drop_name: { text: this.enjoyDataArr[o].n },
              label_drop_chouma: { text: this.enjoyDataArr[o].h },
            }),
              this.dataSource.push(r);
          this.list_drop_history.array = this.dataSource;
        }
      }),
      (e.prototype.onLoadCurYingJiaData = function (t) {
        if (0 == t.code) {
          if (this.currentPage >= 1) {
            if (0 == t.list.length) return void this.currentPage--;
            for (o = 0; o < t.list.length; o++) {
              var e = t.list[o];
              this.enjoyDataArr.push(e), (this.dataSource = []);
            }
          } else (this.enjoyDataArr = t.list), (this.dataSource = []);
          this.isloading = !1;
          for (var r = void 0, o = 0; o < this.enjoyDataArr.length; o++)
            (r = {
              label_drop_index: { text: this.enjoyDataArr[o].r },
              label_drop_name: { text: this.enjoyDataArr[o].n },
              label_drop_chouma: { text: this.enjoyDataArr[o].h },
            }),
              this.dataSource.push(r);
          this.list_drop_history.array = this.dataSource;
        }
      }),
      (e.prototype.onLoadCurTouZhuData = function (t) {
        if (0 == t.code) {
          if (this.currentPage >= 1) {
            if (0 == t.list.length) return void this.currentPage--;
            for (o = 0; o < t.list.length; o++) {
              var e = t.list[o];
              this.enjoyDataArr.push(e), (this.dataSource = []);
            }
          } else (this.enjoyDataArr = t.list), (this.dataSource = []);
          this.isloading = !1;
          for (var r = void 0, o = 0; o < this.enjoyDataArr.length; o++) {
            var i = this.enjoyDataArr[o];
            (r = {
              label_drop_index: { text: "第" + i.i + "轮" },
              label_drop_name: { text: this.dealZhuResult(i.t) },
              label_drop_chouma: {
                text: this.dealWinorLoseResult(i.r) + " " + i.w + " 筹码",
              },
            }),
              this.dataSource.push(r);
          }
          this.list_drop_history.array = this.dataSource;
        }
      }),
      (e.prototype.onLoadCurKaiJiangData = function (t) {
        if (0 == t.code) {
          if (this.currentPage >= 1) {
            if (0 == t.list.length) return void this.currentPage--;
            for (o = 0; o < t.list.length; o++) {
              var e = t.list[o];
              this.enjoyDataArr.push(e), (this.dataSource = []);
            }
          } else (this.enjoyDataArr = t.list), (this.dataSource = []);
          this.isloading = !1;
          for (var r = void 0, o = 0; o < this.enjoyDataArr.length; o++) {
            var i = this.enjoyDataArr[o];
            (r = {
              label_drop_index: { text: "第" + i[0] + "轮" },
              label_drop_name: { text: i[1] + ", " + i[2] + ", " + i[3] },
              label_drop_chouma: {
                text: this.dealCompentResult(i[1], i[2], i[3]),
              },
            }),
              this.dataSource.push(r);
          }
          this.list_drop_history.array = this.dataSource;
        }
      }),
      (e.prototype.dealZhuResult = function (t) {
        return 1 == t
          ? "小"
          : 2 == t
          ? "大"
          : 3 == t
          ? "单"
          : 4 == t
          ? "双"
          : 5 == t
          ? "豹子"
          : t + "";
      }),
      (e.prototype.dealWinorLoseResult = function (t) {
        return "0" == t ? "待定" : "1" == t ? "输" : "2" == t ? "赢" : t;
      }),
      (e.prototype.onLoadMoreHistoryData = function (t) {
        var e = t / this.list_drop_history.scrollBar.max,
          r = new Date(),
          o = !1;
        if (
          (r.getTime() - this.spaceTime >= 3e3 && (o = !0),
          1 == e && 0 == this.isloading && o)
        )
          return (
            (this.isloading = !0),
            this.currentPage++,
            "11" == this.type
              ? WebSocketService.send({
                  c: 1562,
                  d: { pageNum: this.currentPage },
                })
              : "12" == this.type
              ? WebSocketService.send({
                  c: 1563,
                  d: { pageNum: this.currentPage },
                })
              : "13" == this.type &&
                WebSocketService.send({
                  c: 1564,
                  d: { pageNum: this.currentPage },
                }),
            void (this.spaceTime = r.getTime())
          );
      }),
      (e.prototype.dealCompentResult = function (t, e, r) {
        var o,
          i = t + e + r;
        return (
          t == e && e == r && t == r
            ? (o = "豹子")
            : 3 == i || 18 == i
            ? (o = "豹子")
            : i >= 4 && i <= 10
            ? (o = i % 2 ? "小单" : "小双")
            : i >= 11 && i <= 17 && (o = i % 2 ? "大单" : "大双"),
          o
        );
      }),
      (e.prototype.onDropMoneyBackAction = function () {
        (this.list_drop_history.array = []), this.removeSelf();
      }),
      e
    );
  })(ui.ChallengeBattle.DropMoneyHistoryViewUI);
